FROM openjdk:17-jdk-alpine
# 安装时间组件
RUN echo "http://mirrors.aliyun.com/alpine/v3.17/main/" > /etc/apk/repositories \
    && echo "http://mirrors.aliyun.com/alpine/v3.17/community/" >> /etc/apk/repositories \
    && apk add --no-cache --allow-untrusted tzdata freetype fontconfig ttf-dejavu
ENV TZ=Asia/Shanghai
# 设置工作目录
WORKDIR /app
ARG jarName
# 拷贝项目jar包
COPY ${jarName}.jar /app/application.jar
# 设置JVM参数
ENV JVM_ADD_OPENS "--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED --add-opens=java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED"
ENV JAVA_OPTS ""
# 设置启动命令
ENTRYPOINT java $JAVA_OPTS -Duser.timezone=Asia/Shanghai -Djava.security.egd=file:/dev/urandom $JVM_ADD_OPENS -jar application.jar